package cn.tedu.sp04.feign;

import cn.tedu.sp01.pojo.User;
import cn.tedu.web.util.JsonResult;
import org.springframework.stereotype.Component;
import sun.security.util.Password;

@Component
public class UserFeignClientFB implements UserFeignClient {
    @Override
    public JsonResult<User> getUser(Integer userId) {

        //模拟缓存数据

        if(Math.random() <0.5){

            User u = new User(userId,
                    "缓存用户"+userId,
                    "缓存秘密"+ userId);
            return JsonResult.ok().data(u);
        }

        return JsonResult.err().msg("获取用户信息失败");
    }

    @Override
    public JsonResult<?> addScore(Integer userId, Integer score) {
        return JsonResult.err().msg("添加积分失败");
    }
}
